import Vue from 'vue'
// import Router from 'vue-router'
// import home from '../components/home'
// import about from '../components/about'
import VueRouter from 'vue-router'
const home=() =>import('../components/home')
const about=() =>import('../components/about')
const homenews=() =>import('../components/homenews')
const homemessage=() =>import('../components/homemessage')
Vue.use(VueRouter)

const routes = [
    {
      path:'',
      //重定向
      redirect:'/home',
    },
    {
      path: '/home',
      component:home ,
      meta: {  
        title:"Home",
        fullPath:"/home",
        keepAlive: true },
      children:[
        {path:'news',
         component:homenews},
         {path:'message',
         component:homemessage},
      ]
    },
    {
      path: '/about',
      component:about
    },
  ]

const router =new VueRouter({
  routes,
  mode:'history',
  linkActiveClass:"active"
})
//将router对象传入到Vue实例
export default router